﻿Public Class frmChangePassword
    Dim dbBase As New dbUser

    Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
        Dim status As Boolean = True
        If (txtNewPassword.Text.Trim() <> txtRePassword.Text.Trim()) Then
            MessageBox.Show("Password is not match")
            status = False
        End If
        Dim test As String = dbBase.isValidLogin(MDI.LoginID, txtCurrentPassword.Text.Trim())
        If (test = "") Then
            status = False
            MessageBox.Show("Current Password is wrong")
        End If
        If (status) Then
            If (txtCurrentPassword.Text.Trim() <> "" And txtNewPassword.Text.Trim() <> "") Then
                Dim result As String = dbBase.ChangePassword(MDI.LoginID, txtNewPassword.Text.Trim())
                If (result = "Success") Then
                    Me.Close()
                Else : MessageBox.Show(result)
                End If
            Else : MessageBox.Show("Please Fill All Field")
            End If
        End If
    End Sub
End Class